package example.fileupload;

import io.grpc.Server;
import io.grpc.ServerBuilder;

import java.io.IOException;

public class fileServer {
    public static void main(String[] agrc) throws Exception {


        new Thread(() -> {
            try {
                Thread.sleep(1);
//                fileclient3.send();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }).start();
        //-------------------
        Server server = ServerBuilder
                .forPort(50096)
                .addService(new FileUploadService())
                .build();
        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            System.out.println("gRPC server is shutting down!");
            server.shutdown();
        }));
        System.out.println("Starting server...");
        server.start();
        System.out.println("Server started!");
        server.awaitTermination();




//        server.blockUntilShutdown();
    }
}
